package ioc14;

import org.springframework.beans.factory.FactoryBean;

/**
 * Author:shixiaojun@itany.com
 * Date:2022/5/17 11:24
 * Version:1.0-SNAPSHOT
 * Description:
 */
public class SomeServiceFactoryBean implements FactoryBean {

    /**
     * 生产bean的过程
     * @return
     * @throws Exception
     */
    @Override
    public Object getObject() throws Exception {
        ObjectFactory factory = new ObjectFactory();
        SomeService someService = (SomeService) factory.getObject();
        return someService;
    }

    /**
     * 生产的bean是谁,Class类型
     * @return
     */
    @Override
    public Class<?> getObjectType() {
        return SomeServiceImpl.class;
    }

    /**
     * 生产的bean是否是单例的
     * @return
     */
    @Override
    public boolean isSingleton() {
        return false;
    }
}
